package com.egao.common.module.employment.service.impl;

import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.egao.common.module.employment.entity.EmploymentProcess;
import com.egao.common.module.employment.mapper.EmploymentProcessMapper;
import com.egao.common.module.employment.service.EmploymentProcessService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author lym
 * @date 2023/4/26 10:19
 */
@Service
public class EmploymentProcessServiceImpl extends ServiceImpl<EmploymentProcessMapper, EmploymentProcess> implements EmploymentProcessService {

    @Override
    public List<EmploymentProcess> listCollegeWeek(Integer collegeId, Date date) {
        Date startTime = DateUtil.beginOfWeek(date);
        Date endTime = DateUtil.endOfWeek(date);
        return baseMapper.selectList(new LambdaQueryWrapper<EmploymentProcess>()
                .eq(EmploymentProcess::getCollegeId, collegeId)
                .ge(EmploymentProcess::getStartTime, startTime)
                .le(EmploymentProcess::getEndTime, endTime)
                .orderByAsc(EmploymentProcess::getSort)
        );
    }

    @Override
    public List<EmploymentProcess> listTemplate() {
        List<EmploymentProcess> list = new ArrayList<>();
        list.add(new EmploymentProcess(1, "党政联席会讨论就业工作", "加强学科专业预警", "每月1次以上"));
        list.add(new EmploymentProcess(2, "与未就业毕业生谈心谈话", "加强毕业生就业指导", "未就业毕业生就业前每人谈话3次以上"));
        list.add(new EmploymentProcess(3, "与未就业毕业生家长沟通", "加强毕业生就业指导", "未就业毕业生离校前与其家长沟通1次以上"));
        list.add(new EmploymentProcess(4, "动员未就业毕业生参加招聘会", "加强毕业生求职的主动性评价", "未就业毕业生就业前每人参加招聘会3次以上"));
        list.add(new EmploymentProcess(5, "审阅并转发招聘信息，推送至适合的未就业毕业生", "加强毕业生求职的主动性评价", "平均每天转发招聘信息，并推送至合适的未就业毕业生1次以上"));
        list.add(new EmploymentProcess(6, "举办招聘活动", "加强院级就业市场建设", "月度通报进度"));
        list.add(new EmploymentProcess(7, "审核学生毕业去向登记", "加强就业统计", "每天对毕业生登记信息及时进行审核"));
        list.add(new EmploymentProcess(8, "就业困难群体帮扶", "加强就业困难群体帮扶", "向每人推荐3次以上岗位，并给予1次就业指导"));
        list.add(new EmploymentProcess(9, "阐明应届生身份重要性，宣传基层就业项目", "加强就业政策宣传", "毕业生离校前专题介绍基层就业等政策1次以上"));
        list.add(new EmploymentProcess(10, "未就业毕业生离校后的服务跟进方案", "加强毕业生离校后跟踪服务", "告知未就业毕业生暑期学院就业服务事项。每周联系未就业毕业生，在其就业前推荐岗位3次以上，并给予就业指导"));
        return list;
    }

    @Override
    public List<EmploymentProcess> statistics(String startTime, String endTime) {
        return baseMapper.statistics(startTime, endTime);
    }
}
